#!/usr/bin/env python
# -*- coding:utf8 -*-
"""
Author : mafei
Date   : 2019-12-07
"""
import sys
import logging


def init_logger(log_level):
    if len(logging.root.handlers) < 1: # see logging.basicConfig
        fmt = "%(asctime)s %(name)s[%(module)s#%(lineno)d] %(levelname)s %(message)s"
        logging.basicConfig(level=getattr(logging, log_level.upper()), stream=sys.stdout, format=fmt)
    return logging.root